<HTML>
	<HEAD>
	<TITLE> REGISTER USER</TITLE>
	<script type="text/javascript">


function validate_email(field,error)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(error);return false;}
  else {return true;}
  }
}

	
function validate_field(field,error)
{

  var str = field.value;
  
  if (str==null||str=="")
    {alert(error);return false;}
  else
    {return true;}  
}

function validate_isString(field,error)
{
	var str;
	
	str=field.value;
	
	if(str == null || str == "" || !isNaN(str))
	{alert(error);return false;}
	else
	{return true;}

}
	




function validate_phone(field,error)
{
	var n;
	
	n=field.value;
	
	if(n.length>10 || n == null || n == "" || isNaN(n))
	{alert(error);return false;}
	else
	{return true;}

}

function validate_stNum(field,error)
{
	var n;
	
	n=field.value;
	
	if(n == null || n == "" || isNaN(n))
	{alert(error);return false;}
	else
	{return true;}

}

function validate_postCode(field,error)
{
	var n;
	
	n=field.value;
	
	if(n.length!=4 || n == null || n == "" || isNaN(n))
	{alert(error);return false;}
	else
	{return true;}

}


function validate_password(field1,field2,error)
{
var x,y;
with (field1)
 {x = value;}
 with (field2)
 {y = value;}
 if (x!=y)
 {alert(error);return false;}
 else if(x.length < 6)
 {alert("Password must be atleast 6 charactars long");return false;}
 else
 {return true;}
 }
 
function validate_cardNum(field,error)
{

var num;

with (field)
{num = value;}


	if (num.length != 16 || num== null || num == "" )
	{alert(error);return false;}
	else if(num.length == 16)
	{
		if(isNaN(num))
		{alert(error);return false;}
	}
	else
	{return true;}
	
}
 
 
function validate_date(field2,field3,error)
{
var d = new Date;

current_mm = d.getMonth();
current_yy = d.getFullYear();

var mm,yy;



with (field2)
{mm = value;}

with (field3)
{yy = value;}

if (yy < current_yy)
{alert(error);return false;}
else if (yy == current_yy)
{
if (mm < current_mm)
{alert(error);return false;}
}
else
{return true;}


}

function validate_form(thisform)
{
with (thisform)
	{


	if (validate_isString(firstname,"You can only have letters in the First name field")==false)
	{firstname.focus();return false;}
	
	if (validate_isString(lastname,"You can only have letters in the Last name field")==false)
	{lastname.focus();return false;}
	
	if (validate_email(email,"Please enter a valid Email Address!")==false)
	{email.focus();return false;}
	
	if (validate_phone(phone,"Please enter a valid Phone number!")==false)
	{phone.focus();return false}
	
	if (validate_stNum(stnum,"Please enter a valid Street number!")==false)
	{stnum.focus();return false}
	
	if (validate_isString(stname,"Please enter a valid Street Name!")==false)
	{stname.focus();return false}
	
	if (validate_isString(sub,"Please enter a valid suburb name!")==false)
	{sub.focus();return false}
	
	if (validate_postCode(pc,"Please enter a valid postcode!")==false)
	{pc.focus();return false}
	
	if (validate_field(password,"Password field cannot be blank!")==false)
	{password.focus();return false;}
	
	if (validate_field(confirm_password,"Please enter a valid Confirm Password!")==false)
	{confirm_password.focus();return false;}
	
	if (validate_password(password,confirm_password,"Password and Confirm Password do not match!")==false)
	{password.focus();return false;}
	
	if (validate_cardNum(card_num,"Please enter a valid Credit Card Number!")==false)
	{card_num.focus();return false;}
	
	if (validate_date(month,year,"Your Credit Card does must be valid for minimum 2 more months!")==false)
	{year.focus();return false;}
	
	
	
	
	}
	
}


	</script>
	</TITLE>
<link rel="stylesheet" href="http://www.webng.com/kbxtc/css/style.css" type="text/css" />
	</HEAD>
	
	<BODY>


	<div id="dolphincontainer">
  <div id="dolphinnav">
    <ul>
      <li><a href="http://www.webng.com/kbxtc/register.html" class="current" ><span>REGISTER</span></a></li>
      <li><a href="http://www.webng.com/kbxtc/login.asp" ><span>LOGIN</span></a></li>
 
    </ul>
  </div>
</div>
	   <FORM  METHOD=POST ACTION ="registerUser.asp" onSubmit="return validate_form(this);">
		<TABLE>
		 <TR>
		   <TD align=right>First name:</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="firstname"></TD>
		 </TR>
		 <TR><TD> </TD></TR>
	

		 <TR>
		   <TD align=right>Last name:</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="lastname"></TD>
		 </TR>
		<TR><TD> </TD></TR>

		 

		<TR>
		   <TD align=right>Email:</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="email"></TD>
		 </TR>
		 <TR><TD> </TD></TR>
		 
		<TR>
		   <TD align=right>Phone Number:</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="phone"></TD>
		 </TR>
		 <TR><TD> </TD></TR>
		 
		 <TR>
		   <TD align=right>Unit/Street Number:</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="stnum"></TD>
		 </TR>
		 <TR><TD> </TD></TR>
		 
		  <TR>
		   <TD align=right>Street Name:</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="stname"></TD>
		 </TR>
		 <TR><TD> </TD></TR>
		 
		  <TR>
		   <TD align=right>Suburb:</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="sub"></TD>
		 </TR>
		 <TR><TD> </TD></TR>
		 
		  <TR>
		   <TD align=right>Postcode:</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="pc"></TD>
		 </TR>
		 <TR><TD> </TD></TR>
		 
		 <TR>
		   <TD align=right>Password:</TD>
		   <TD align=left><INPUT TYPE=PASSWORD NAME="password"></TD>
		 </TR>
		<TR><TD> </TD></TR>
		 <TR>
		   <TD ID="td1" align=right>Confirm Password:</TD>
		   <TD align=left><INPUT TYPE=PASSWORD NAME="confirm_password"></TD>
		 </TR>
		<TR><TD> </TD></TR>
		 <TR>
		   <TD align=right>Credit Card Number:</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="card_num"></TD>
		 </TR>
		<TR><TD> </TD></TR>
		<TR>
		 <TR>
		   <TD ID="td1" align=right>Expiry Month(mm):</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="month"</TD>
		 </TR>
		<TR><TD> </TD></TR>
		<TR>
		   <TD align=right>Expiry Year(yyyy):</TD>
		   <TD align=left><INPUT TYPE=TEXT NAME="year"</TD>
		 </TR>
		<TR><TD> </TD></TR>
		</TABLE>
		<INPUT TYPE=RESET> <INPUT TYPE=SUBMIT><BR><BR>
	   </FORM>
	
	</BODY>
</HTML>